package com.book.controller;

import com.book.dto.ClassPage;
import com.book.entity.BookClass;
import com.book.service.BookClassService;
import com.book.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yicheng
 */
@RestController
@RequestMapping("/bookClass")
public class BookClassController {
    @Autowired
    private BookClassService bookClassService;
//书籍分类管理，这里是所有的分类，不是某本书自己的分类
    @PostMapping("/getClass")
    public ResponseResult getClass(@RequestBody ClassPage classPage){
        return bookClassService.getClass(classPage);
    }

    @GetMapping("/deleteClass")
    public ResponseResult deleteClass(@RequestParam int id){
        return bookClassService.deleteClass(id);
    }

    @GetMapping("/getOne")
    public ResponseResult getOne(@RequestParam int id){
        return bookClassService.getOne(id);
    }

    @PostMapping("/saveClass")
    public ResponseResult saveClass(@RequestBody BookClass bookClass){
        return bookClassService.saveClass(bookClass);
    }


}
